package practical;

import java.awt.Point;

/**
 * equal and "==" 觀念糾正<br>
 * <br>
 * Copyright: Copyright (c) 2001-2007<br>
 * Company: 一零四資訊科技股份有限公司
 * @author Eric.Kao(eric.kao@104.com.tw)
 * @version 1.0
 */
public class Practical003
{
    public Practical003()
    {
        Point pa = new Point( 0, 0 );
        Point pb = new Point( 0, 0 );

        System.out.println( "Test(==):" + ( pa == pb ) );

        //為 true, 為 Point 有去實做 method equal()
        System.out.println( "Test(equal):" + ( pa.equals( pb ) ) );


        /**
         * ======================================================
         *    Non override method equal()
         * ======================================================  
         */
        CompanyBean beanA = new CompanyBean( "e885", 0 );
        CompanyBean beanB = new CompanyBean( "e885", 0 );

        System.out.println( "Test(==):" + ( beanA == beanB ) );

        //為 false, 因為 CompanyBean don't override method equal()
        System.out.println( "Test(equal):" + ( beanA.equals( beanB ) ) );
    }

    public static void main( String[] args )
    {
        new Practical003();
    }
}
